//
//  TSSendMsgListViewController.m
//  chart
//
//  Created by xu on 15/7/29.
//  Copyright (c) 2015年 xu. All rights reserved.
//

#import "TSRecycleMsgListViewController.h"
#import "TSRecycleMsgTableView.h"
#import "TSCreateMsgViewController.h"

@implementation TSRecycleMsgListViewController{
    TSRecycleMsgTableView *tableView;
}
@synthesize isSchedule;
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(messageChangeOrPostSucceeded:) name:TSNotification_MessageChangeSucceeded object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(messageChangeOrPostSucceeded:) name:TSNotification_MessagePostSucceeded object:nil];
    
    self.navigationItem.title = @"回收站";
    
//    [self rightBarButtonWithTitle:nil barNorImage:[UIImage imageNamed:@"topic_follow_add"] barHltImage:nil action:^{
//        if (!weakSelf) {
//            return;
//        }
//        UIActionSheet *action_sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:weakSelf cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"创建消息",@"回收站", nil];
//        [action_sheet showInView:weakSelf.view];
//        
//    }];
    WS(weakSelf);
    [self leftBarButtonWithTitle:nil barNorImage:[UIImage imageNamed:@"nav_dark_close"] barHltImage:nil action:^{
        if (!weakSelf) {
            return;
        }
        
        [weakSelf dismissViewControllerAnimated:YES completion:nil];
    }];
    tableView = [[TSRecycleMsgTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain isSchedule:isSchedule];
    tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [self.view addSubview:tableView];
}



/* 修改信息后更新发送列表 */
- (void)messageChangeOrPostSucceeded:(NSNotification *)noti
{
    if (tableView) {
        [tableView.header beginRefreshing];
    }
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}




@end
